﻿CREATE PROCEDURE [dbo].[sp_CreateTemplateInstance] 
    @templateName nvarchar(256), 
	@instanceName nvarchar(256) 
AS 
BEGIN
INSERT INTO TemplateInstances(TemplateId,TemplateInstanceName) 
SELECT [TemplateId],@instanceName FROM PackageTemplates WHERE [TemplateName] = @templateName;
SELECT SCOPE_IDENTITY();
END


